<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<style type="text/css">
	.exam_body_noreview{border: 1px solid lightgray;width:650px;height:100px;color: #5D5D5D;font-size:18px;font-weight: bold;margin: auto;margin-bottom: 30px;padding:50px;text-align: center;}
	.tag_to_review{width: 120px;height:40px;padding-top:10px;float: left;text-align: center;color:white;}
	.tag_to_review a{color:white;}
	.tag_to_examinfo{background-color:white;border-bottom: 5px solid #F15F5F;width: 120px;height:25px;padding-top:10px;float: left;text-align: center;}
	.tag_to_examinfo a{color: #5D5D5D;}
	.exam_body{width: 752px;margin: auto;}
	.exam_body_total{border: 1px solid lightgray;width:750px;height:75px;margin: auto;}
	.exam_body_total_score{width: 710px;height: 30px;margin-top:20px;margin-left:20px;float: left;}
	.exam_body_total_score_text{width: 100px;height:25px;color: #5D5D5D;font-size:15px;font-weight: bold;margin-top:7px;margin-left:10px;float: left;}
	.exam_body_total_score_star{width: 150;float: left;}
	.exam_body_total_score_score{width: 150;color: #5D5D5D;font-size:15px;font-weight: bold;margin-top:7px;margin-left:15px;float: left;}
	.exam_body_review{border: 1px solid lightgray;width:750px;margin: auto;}
	.exam_body_review_left{width : 150px;margin-top: 20px;margin-left: 20px;float: left;}
	.exam_body_review_left_result_img{width:30px;height:30px;color: #5D5D5D;font-size:13px;float:left;}
	.exam_body_review_left_result_text{width:110px;height:13px;font-size:13px;margin-top:2px;margin-left:10px; float:left;}
	.exam_body_review_left_regdate{width:110px;height:13px;color:#5D5D5D;font-size:11px;margin-top:4px;margin-left:10px; float:left;}
	.exam_body_review_left_level_indi{width:150px;height:13px;color: #5D5D5D;margin-top:20px;font-size:13px;float:left;}
	.exam_body_review_left_level{width:150px;height: 25px;margin-top:5px;float:left;}
	.exam_body_review_left_examdate_indi{width:150px;height:13px;color: #5D5D5D;margin-top:20px;font-size:13px;float:left;}
	.exam_body_review_left_examdate{width:150px;height:25px;color:#5D5D5D;margin-top:5px;font-size:13px;float:left;}
	.exam_body_review_right{width:560px;margin-top:20px;margin-bottom:20px;margin-right: 20px;float: left;}
	.exam_body_review_right_title{border:1px solid lightgray;border-radius:2px;background-color:#F6F6F6;width: 538px;color: #5D5D5D;font-size:15px;font-weight: bold;padding: 10px;float: left;}
	.exam_body_review_right_process{width: 560px;margin-top:20px;float: left;}
	.exam_body_review_right_process_indi{width: 95px;height:50px;color:#2BA5BA;font-size:13px;font-weight: bold;margin-left:5px;float: left;}
	.exam_body_review_right_process_content{width: 460px;color: #5D5D5D;font-size:13px;float: left;}
	.exam_body_review_right_question{width: 560px;margin-top:20px;float: left;}
	.exam_body_review_right_question_indi{width: 95px;height:50px;color:#F15F5F;font-size:13px;font-weight: bold;margin-left:5px;float: left;}
	.exam_body_review_right_question_content{width: 460px;color: #5D5D5D;font-size:13px;float: left;}
	.exam_body_review_right_accuse{width: 60px;height:13px;font-size:13px;margin-top:30px;margin-left: 500px;float: left;}
	.exam_body_page{margin: auto;margin-bottom: 30px;width: 750px;text-align: center;}
</style>
<script type="text/javascript">
	function accuse(review_no){
		if(confirm("해당 리뷰를 신고하시겠습니까?")){
			location.href("review.do?command=accuse&&review_no="+review_no);
		}
	}
	
	$(function(){
		$('.tag_to_review>a').click(function(){
			$('.tag_to_review').removeClass('tag_to_examinfo').addClass('tag_to_review');
			$('.tag_to_examinfo').removeClass('tag_to_review').addClass('tag_to_examinfo');
		});
	});
</script>
</head>
<body>
<c:import url="../index/header.jsp"></c:import><br>
<c:import url="major_header.jsp"></c:import><p>
<div class="exam_body">
	<c:choose>
		<c:when test="${ requestScope.eList.length==0 }">
			<div class="exam_body_noreview">
				해당 학과의 입시 리뷰가 없습니다.<p>
				<a href="review.do?command=selectUnitExaminfo"><img alt="" src="../img/view/review/exam_button.png" width="200px"></a>
			</div>
		</c:when>
		<c:otherwise>
			<div class="exam_body_total">
				<div class="exam_body_total_score">
					<div class="exam_body_total_score_text">
						평균 난이도
					</div>
					<div class="exam_body_total_score_star">
						<c:set var="total_levelAvg" value="${ mrvo.levelAvg }"/>
						<c:set var="total_levelAvg_round" value="${ total_levelAvg+((total_levelAvg%1>0.5)?(1-(total_levelAvg%1))%1:-(total_levelAvg%1)) }"/>
						<c:forEach begin="1" end="${ total_levelAvg_round }"><img alt="" src="../img/view/review/star_level.png" width="30px" height="30px"></c:forEach><c:forEach begin="1" end="${ 5-total_levelAvg_round }"><img alt="" src="../img/view/review/star_deselected.png" width="30px" height="30px"></c:forEach>
					</div>
					<div class="exam_body_total_score_score">
						${ mrvo.levelAvg }점
					</div>
				</div>
			</div><p>
			
			<div class="exam_body_review">
				<c:forEach var="aExam" items="${ requestScope.eList.examinfoList }">
					<div class="exam_body_review_left">
						<div class="exam_body_review_left_result_img">
							<c:choose>
								<c:when test="${ aExam.examinfo_result == 0 }">
									<img alt="" src="../img/view/review/good.png" width="30px" height="30px">
								</c:when>
								<c:otherwise>
									<img alt="" src="../img/view/review/bad.png" width="30px" height="30px">
								</c:otherwise>
							</c:choose>
						</div>
						<div class="exam_body_review_left_result_text">
							<c:choose>
								<c:when test="${ aExam.examinfo_result == 0 }">
									<font style="color: #2BA5BA">합격</font>
								</c:when>
								<c:otherwise>
									<font style="color: #F15F5F">불합격</font>
								</c:otherwise>
							</c:choose>
						</div>
						<div class="exam_body_review_left_regdate">
							2014-1-23<%-- ${ aExam.examinfo_regdate } --%>
						</div>
						<div class="exam_body_review_left_level_indi">
							난이도
						</div>
						<div class="exam_body_review_left_level">
							<c:set var="examinfo_level" value="${ aExam.examinfo_level }"/>
							<c:set var="examinfo_level_round" value="${ examinfo_level+((examinfo_level%1>0.5)?(1-(examinfo_level%1))%1:-(examinfo_level%1)) }"/>
							<c:forEach begin="1" end="${examinfo_level_round}"><img alt="" src="../img/view/review/star_level.png" width="25px" height="25px"></c:forEach><c:forEach begin="1" end="${5-examinfo_level_round }"><img alt="" src="../img/view/review/star_deselected.png" width="25px" height="25px"></c:forEach>
						</div>
						<div class="exam_body_review_left_examdate_indi">
							응시날짜
						</div>
						<div class="exam_body_review_left_examdate">
							2014-1-23<%-- ${ aExam.examinfo_examdate } --%>
						</div>
					</div>
					<div class="exam_body_review_right">
						<div class="exam_body_review_right_title">
							"${ aExam.examinfo_title }${ aExam.examinfo_title }${ aExam.examinfo_title }"
						</div>
						<div class="exam_body_review_right_process">
							<div class="exam_body_review_right_process_indi">
								과정
							</div>
							<div class="exam_body_review_right_process_content">
								${ aExam.examinfo_process }
							</div>
						</div>
						<div class="exam_body_review_right_question">
							<div class="exam_body_review_right_question_indi">
								질문
							</div>
							<div class="exam_body_review_right_question_content">
								${ aExam.examinfo_question }
							</div>
						</div>
						<div class="exam_body_review_right_accuse">
							<a href="javascript:accuse('${ aExam.examinfo_no }')" style="text-decoration: none; color: #5D5D5D;">신고하기</a>
						</div>
					</div><hr style="margin-left: 20px; margin-right: 20px; border: 1px solid lightgray;">
				</c:forEach>
			</div><p>
			
			<div class="exam_body_page">
				<c:set var="page" value="${requestScope.eList.pageManager}" />
		
				<c:if test="${page.currGroup==1}"><img alt="" src="../img/button/page_begin.gif"></c:if>
				<c:if test="${page.currGroup!=1}">
					<a href="review.do?command=${param.command}&&page=1&&majorunit_no=${param.majorunit_no}"style="text-decoration: none; color: #5D5D5D;"><img alt="" src="../img/button/page_begin.gif"></a>
				</c:if>
			
				<c:if test="${page.existOfPreviousGroup}">
					<a href="review.do?command=${param.command}&&page=${page.firstPageInCurrGroup-page.pagePerGroup}&&majorunit_no=${param.majorunit_no}"style="text-decoration: none; color: #5D5D5D;">
						<img alt="" src="../img/button/page_prev.gif"></a>
				</c:if>
				<c:if test="${!page.existOfPreviousGroup}"><img alt="" src="../img/button/page_prev.gif"></c:if>
			
				<c:forEach var="pageIndex" begin="${page.firstPageInCurrGroup}"
					end="${page.lastPageInCurrGroup}">
					<c:if test="${pageIndex==page.currPage}">&nbsp;<font color="#ff6d66">${pageIndex}</font>&nbsp;</c:if>
					<c:if test="${pageIndex!=page.currPage}">
						<a href="review.do?command=${param.command}&&page=${pageIndex}&&majorunit_no=${param.majorunit_no}"style="text-decoration: none; color: #5D5D5D;">&nbsp;<font color="#606060">${pageIndex}</font>&nbsp;</a>
					</c:if>
				</c:forEach>
			
				<c:if test="${page.existOfNextGroup}">
					<a href="review.do?command=${param.command}&&page=${page.lastPageInCurrGroup+1}&&majorunit_no=${param.majorunit_no}"style="text-decoration: none; color: #5D5D5D;">
						<img alt="" src="../img/button/page_next.gif"></a>
				</c:if>
				<c:if test="${!page.existOfNextGroup}"><img alt="" src="../img/button/page_next.gif"></c:if>
			
				<c:if test="${page.currGroup==page.totalGroup}"><img alt="" src="../img/button/page_end.gif"></c:if>
				<c:if test="${page.currGroup!=page.totalGroup}">
					<a href="review.do?command=${param.command}&&page=${page.totalPage}&&majorunit_no=${param.majorunit_no}"style="text-decoration: none; color: #5D5D5D;"><img alt="" src="../img/button/page_end.gif"></a>
				</c:if>
			</div>
		</c:otherwise>
	</c:choose>
</div>
</body>
</html>